import { ref } from 'vue';
import useDataLoad from '@/hooks/useDataLoad.ts';
import { getMyPubQueryOrder } from "@/api/query"
import { onShow } from "@dcloudio/uni-app"
export default function usePosts() {

	const dataLoad = useDataLoad(getMyPubQueryOrder);
	// 当前订单列表状态
	const currentTab = ref(0);
	const tabs = ref(['全部信息查询', '待完成', '售后/平台介入']);

	const tabsChange = ({ index, name }) => {
		currentTab.value = index;
		dataLoad.setParams({
			status: currentTab.value
		});
		dataLoad.reGetData();
	};
	dataLoad.setParams({
		status: currentTab.value
	});
	onShow(() => {
		dataLoad.getData();
	})

	return {
		currentTab,
		tabsChange,
		tabs,
		...dataLoad
	};
}